<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="css/eui.css">
    <style>
        a{
            text-decoration: none;
        }
    </style>
</head>
<body>

<div id="app">
    <div>
    <!--页头组件-->
    <el-page-header style="background-color: #FF6537;color: white;line-height: 60px"
                    @back="goBack" content="退换商品申请页面"></el-page-header>
    </div>
    <!--分割线-->
    <el-divider></el-divider>
    <div>
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
            <el-form-item label="退换性质" prop="type">
                <el-checkbox-group v-model="ruleForm.type">
                    <el-checkbox label="退货" name="type"></el-checkbox>
                    <el-checkbox label="换货" name="type"></el-checkbox>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="退换原因" prop="name">
                <el-input v-model="ruleForm.name"></el-input>
            </el-form-item>
            <el-form-item label="退换地址" prop="region">
                <el-select v-model="ruleForm.region" placeholder="请选择此地址原路退回">
                    <el-option label="北京天安门" value="shanghai"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submitForm('ruleForm')"><a href="exchangeIsInpProgress.html">立即创建</a></el-button>
                <el-button @click="resetForm('ruleForm')">重置</el-button>
            </el-form-item>
        </el-form>
    </div>

</div>

</div>
</body>
<!-- import Vue before Element -->
<script src="js/vue.js"></script>
<!-- import JavaScript -->
<script src="js/eui.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data() {
            return {
                active: 0,
                ruleForm: {
                    name: '',
                    region: '',
                    type: [],
                },
                rules: {
                    name: [
                        { required: true, message: '请输入退换原因', trigger: 'blur' },
                        { min: 10, max: 100, message: '长度在 10 到 100 个字符', trigger: 'blur' }
                    ],
                    region: [
                        { required: true, message: '请选择退货地址', trigger: 'change' }
                    ],
                    type: [
                        { type: 'array', required: true, message: '请至少选择一个选项', trigger: 'change' }
                    ],
                }
            };
        },
        methods: {
            goBack(){
                //返回上一页面
                history.back();
            },
                submitForm(formName) {
                    this.$refs[formName].validate((valid) => {
                        if (valid) {
                            alert('创建成功');
                        } else {
                            console.log('创建失败!!');
                            return false;
                        }
                    });
                },
                resetForm(formName) {
                    this.$refs[formName].resetFields();
            }
        }
    })
</script>
</html>

<!--
use cs;
create table product(id int primary key auto_increment,title varchar(100),url varchar(255),price double(10,2),old_price double(10,2),view_count int,sale_count int,created timestamp, category_id int)charset=utf8;

-->